<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>添加/修改页面</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../../component/elementUI/index.css">
    <link rel="stylesheet" href="../../../component/pear/css/pear.css"></el-input>
    <link rel="stylesheet" href="../../../style/wangeditor.css">
    <link rel="stylesheet" href="../../../style/index.css">
</head>

<body>
    <div id="app" v-cloak>
        <div class="add">
            <div class="header">
                <span> 
                    <!-- {{(action == 'Add'?'添加':'修改')}} -->
                    检测报告管理</span>
            </div>
            <div class="main" style="padding: 0 15px;">
                <!-- 配置属性, 目前仅支持 单主表 多子表 结构 -->
                <div id="form" :data-options="JSON.stringify({'tableName':'detection','formName':'dataForm' ,'primaryKey':'Detection_SerialNumber'})">
                    <!-- 子表 -->
                    <div :data-options="JSON.stringify({'tableName':'detection_results','formName':'childDataForm' ,'parentTableName':'detection'})"></div>
                    <div :data-options="JSON.stringify({'tableName':'detection_attachment','formName':'childDataForm' ,'parentTableName':'detection'})"></div>
                
                </div>
                <div class="table_titel">
                    <div class="titel">检测报告详情</div>
                </div>

                <el-form :model="dataForm" ref="form" :inline-message="true" style="width: 100%">
                    <el-descriptions :column="2" size="large" border>        
                        <el-descriptions-item>
                            <template slot="label">
                                <div class="cell-item required">溯源批次号</div>
                            </template>
                            <el-form-item prop="Traceability_Batch_SerialNumber" :rules="[{ required: true, message: '请选择溯源批次号', trigger: 'change' }]">
                                <!-- <el-select v-model.trim="dataForm.Traceability_Batch_SerialNumber" placeholder="请选择溯源批次号" style="width: 100%;" clearable filterable>
                                    <el-option v-for="(item,index) in traceability_batch" :key="index" :label="item.Traceability_Batch_SerialNumber" :value="item.Traceability_Batch_SerialNumber" />
                                </el-select> -->
                                {{dataForm.Traceability_Batch_SerialNumber}}
                            </el-form-item>
                        </el-descriptions-item>
                        <el-descriptions-item>
                            <template slot="label">
                                <div class="cell-item">企业名称</div>
                            </template>
                            <el-form-item prop="Enterprise_Info_SerialNumber"
                                :rules="[{ required: true, message: '请输入企业名称', trigger: 'blur' }]">
                                <!-- <el-input v-model.trim="dataForm.Enterprise_Info_SerialNumber"
                                    placeholder="请输入企业名称"></el-input> -->
                                    {{dataForm.Enterprise_Info_SerialNumber}}
                            </el-form-item>
                        </el-descriptions-item>

                        <el-descriptions-item>
                            <template slot="label">
                                <div class="cell-item">检测日期</div>
                            </template>
                            <el-form-item prop="Detection_Date"
                                :rules="[{ required: true, message: '请输入基地名称', trigger: 'blur' }]">
                                <!-- <el-input v-model.trim="dataForm.Detection_Date"
                                    placeholder="请输入基地名称"></el-input> -->
                                    {{dataForm.Detection_Date}}
                            </el-form-item>
                        </el-descriptions-item>
                        <el-descriptions-item>
                            <template slot="label">
                                <div class="cell-item">检测机构</div>
                            </template>
                            <el-form-item prop="Testing_Agency"
                                :rules="[{ required: true, message: '请输入检测机构', trigger: 'blur' }]">
                                <!-- <el-input v-model.trim="dataForm.Testing_Agency"
                                    placeholder="请输入检测机构"></el-input> -->
                                    {{dataForm.Testing_Agency}}
                            </el-form-item>
                        </el-descriptions-item>                       
                    </el-descriptions>
                </el-form>

                <div class="table_titel">
                    <div class="titel">检测结果</div>
                    <div class="operation">
                        <el-button type="primary" size="small" @click="handleAdd('childDataForm')">新增</el-button>
                        <el-button type="danger" size="small" @click="handleRemove('childDataForm')">删除</el-button>
                    </div>
                </div>
                <el-form :model="{childDataForm:childDataForm.filter(i=>i.Row_Status != '1')}" ref="childForm"
                    :inline-message="true" style="width: 100%">
                    <el-descriptions :column="2" size="large" border
                        v-for="(item,index) in childDataForm.filter(i=>i.Row_Status != '1')" :key="index">

                        <el-descriptions-item>
                            <template>
                                <el-table  :data="tableData" style="width: 100%">
                                <el-table-column :prop="`childDataForm.${index}.Project_Name`" label="项目名称" width="180">
                                </el-table-column>
                                <el-table-column :prop="`childDataForm.${index}.Unit`" label="单位" width="180">
                                </el-table-column>
                                <el-table-column :prop="`childDataForm.${index}.Standard_Value`" label="标准值">
                                </el-table-column>
                                 <el-table-column :prop="`childDataForm.${index}.Measured_Value`" label="实测值">
                                </el-table-column>
                                 <el-table-column :prop="`childDataForm.${index}.Remarks`" label="备注">
                                </el-table-column>
                                </el-table>
                            </template>
                        </el-descriptions-item>
                    </el-descriptions>
                </el-form>

                <div class="table_titel">
                    <div class="titel">报告附件报告</div>
                    <div class="operation">
                        <el-button type="primary" size="small" @click="handleAdd('childDataForm')">新增</el-button>
                        <el-button type="danger" size="small" @click="handleRemove('childDataForm')">删除</el-button>
                    </div>
                </div>
                <el-form :model="{childDataForm:childDataForm.filter(i=>i.Row_Status != '1')}" ref="childForm"
                    :inline-message="true" style="width: 100%">
                    <el-descriptions :column="2" size="large" border
                        v-for="(item,index) in childDataForm.filter(i=>i.Row_Status != '1')" :key="index">
                        <el-descriptions-item>
                            <template slot="label">
                                <div class="cell-item">上传附件</div>
                            </template>
                            <el-form-item :prop="`childDataForm.${index}.Attachment_URL`"
                                :rules="[{ required: true, message: '请选择附件', trigger: 'blur' }]">
                            </el-form-item>
                            <el-upload class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/"
                                :on-preview="handlePreview" :on-remove="handleRemove" :file-list="fileList" list-type="picture">
                                <el-button size="small" type="primary">点击上传</el-button>
                                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
                                </el-upload>
                        </el-descriptions-item>
                    </el-descriptions>
                </el-form>
            </div>
            <div class="footer">
                <el-button size="medium" @click="handleBack">返回</el-button>
                <el-button size="medium" type="primary" plain @click="handleSubmit" :loading="loading">提交</el-button>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="../../../utils/wangeditor.js"></script>
    <script type="text/javascript" src="../../../utils/xlsx.full.min.js"></script>
    <script type="text/javascript" src="../../../utils/jquery.min.js"></script>
    <script type="text/javascript" src="../../../utils/jquery.cookie.js"></script>
    <script type="text/javascript" src="../../../utils/vue.min.js"></script>
    <script type="text/javascript" src="../../../utils/vuex.min.js"></script>
    <script type="text/javascript" src="../../../component/elementUI/index.js"></script>
    <script type="text/javascript" src="../../../utils/components.js"></script>
    <script type="text/javascript" src="../../../utils/compressor.js"></script>
    <script type="text/javascript" src="../../../utils/validity.js"></script>
    <script type="text/javascript" src="../../../utils/utils.js"></script>
    <script type="text/javascript" src="../../../utils/http.js"></script>
    <script type="text/javascript" src="js/add.js"></script>
</body>

</html>